package mk.company.fin.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
//import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
//import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import mk.company.fin.FinConstants;

@Entity
@Table(name = FinConstants.Tables.KOMINTENT)
public class Komintent extends Model {

	private static final long serialVersionUID = 9111585097017453205L;

	// persistent
	private Long id;
	private String name;
	private String shortName;
	private String uniqueTaxNumber;
	private String place;
	private String address;
	private String telephone;
	private String fax;
	private String code;
	private String EMBG;
	private String bankName;
	private String accoutNumber;
	
	@Column
	public String getBankName() {
		return bankName;
	}

	public void setBankName(String bankName) {
		this.bankName = bankName;
	}

	@Column
	public String getAccoutNumber() {
		return accoutNumber;
	}

	public void setAccoutNumber(String accoutNumber) {
		this.accoutNumber = accoutNumber;
	}

	private List<NalogEntry> nalogEntries;

	@Column(length = 20, unique = true)
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(length = 30, nullable = false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(length = 15, nullable = false)
	public String getShortName() {
		return shortName;
	}

	public void setShortName(String shortName) {
		this.shortName = shortName;
	}

	@Column(unique = true, length = 20, nullable = false)
	public String getUniqueTaxNumber() {
		return uniqueTaxNumber;
	}

	public void setUniqueTaxNumber(String uniqueTaxNumber) {
		this.uniqueTaxNumber = uniqueTaxNumber;
	}

	@Column(length = 30, nullable = false)
	public String getPlace() {
		return place;
	}

	public void setPlace(String place) {
		this.place = place;
	}

	@Column(length = 50)
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(length=30)
	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	@Column(length=30)
	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	@Column(length=20, nullable=false)
	public String getEMBG() {
		return EMBG;
	}

	public void setEMBG(String eMBG) {
		EMBG = eMBG;
	}

	

	@Id
	@Column(name = "id_komintent")
	// @SequenceGenerator(name = "komintent_seq", sequenceName =
	// "komintent_seq", allocationSize = 1)
	@GeneratedValue
	// (strategy = GenerationType.SEQUENCE, generator = "komintent_seq")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@OneToMany(mappedBy = "komintent", orphanRemoval = false, fetch = FetchType.LAZY)
	public List<NalogEntry> getNalogEntries() {
		return nalogEntries;
	}

	public void setNalogEntries(List<NalogEntry> nalogEntries) {
		this.nalogEntries = nalogEntries;
	}

}
